UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6wYhrvSxKbNIqc1qMHbG+WTI/w2sT8twXArV78zOz7I='
WHERE
key_id = '3112db1bbd8e51d22b14225ff6c946d561a2b058f152a9833b1961cddee95908'
AND (
token = '6wYhrvSxKbNIqc1qMHbG+WTI/w2sT8twXArV78zOz7I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)