UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qZk4tEj+DdbHH33rGuLuyYXoFRrDqeskAFedjBS+1S0='
WHERE
key_id = '4dfd6d6938c4f492a3024ba30f9dcc3200dee805e43d788efd5d1c00dc500af0'
AND (
token = 'qZk4tEj+DdbHH33rGuLuyYXoFRrDqeskAFedjBS+1S0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)