UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XRtvGEYULG9DLSafnBt3CNbVc7GXJz9H9lyiVXaJOUI='
WHERE
key_id = 'e76dcefb0f5543509ac0476b51b46e61a1fff7d7dcb5bb5f9c4461297fef2d50'
AND (
token = 'XRtvGEYULG9DLSafnBt3CNbVc7GXJz9H9lyiVXaJOUI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)