UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kui0DUWORFKN8L4b3YGHEjGxySZBvyq99w+1qbTEv+Y='
WHERE
key_id = 'bbcbc1eed6d7848001c3a85e5e20bff4edb7f1391722f603dada943c86160d67'
AND (
token = 'kui0DUWORFKN8L4b3YGHEjGxySZBvyq99w+1qbTEv+Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)