UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XQ9xDXfh36bu0PePMjYD6P5G2hEv+QAiyu9KuGdr5lk='
WHERE
key_id = 'db795043ac14b4dd3bca70afada5239924172709f4b3db1410e0e07ba3200d11'
AND (
token = 'XQ9xDXfh36bu0PePMjYD6P5G2hEv+QAiyu9KuGdr5lk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)