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