UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RXrXKHsS6pNVb4I48b5+Zj/SuXL9+t+dw/KgHwIKLCA='
WHERE
key_id = 'ae31415b3fde329d62ad1707998628c2cf606107c48fdaf3c586882b0bc3eddd'
AND (
token = 'RXrXKHsS6pNVb4I48b5+Zj/SuXL9+t+dw/KgHwIKLCA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)