UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YEgOWlw30jgPw7ujUmy/duLP+enqK+mESnD/SJfSER8='
WHERE
key_id = '8e4daf29d259c8d6430da09c3f6c53e4f39309824367e478d2b1cd04493d519c'
AND (
token = 'YEgOWlw30jgPw7ujUmy/duLP+enqK+mESnD/SJfSER8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)