UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZXXO4Ym+nccj6SJvJSY5GmbjMpUPICzbXlsJ7LQsI6Y='
WHERE
key_id = 'a02b4e5304b66ee88f7679258321271593892162c18cd9fb551a156925984811'
AND (
token = 'ZXXO4Ym+nccj6SJvJSY5GmbjMpUPICzbXlsJ7LQsI6Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)