UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GuvhLx4ZaBja57s+RDd1O3hlkauZhcGoYeDNC/6Xxn0='
WHERE
key_id = 'ff6f23c9f286dc6cb748a65fff6551c8fef9714e70862ec055a39e32b85e8840'
AND (
token = 'GuvhLx4ZaBja57s+RDd1O3hlkauZhcGoYeDNC/6Xxn0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)