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