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