UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oB+7iu7G1g5auudOQi4Y2l715zM3uQrQJqq7AYyquAk='
WHERE
key_id = 'e8a8f33cf8b822f018c3a9dc318e05129d81db181a36abea09aaa348f294f6e9'
AND (
token = 'oB+7iu7G1g5auudOQi4Y2l715zM3uQrQJqq7AYyquAk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)