UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aZXc8Un36QW+rHKcuMUhzoa4G0Do0o22vl/EnpWWrKc='
WHERE
key_id = '427365cc38f5b7030b432a14cba3cc0ac9e76c8944bad7250925f436d4701bbb'
AND (
token = 'aZXc8Un36QW+rHKcuMUhzoa4G0Do0o22vl/EnpWWrKc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)