UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AFOUdyVSNnnvyg+751VoORSXxDg0SDRMgSMQ8ImhQik='
WHERE
key_id = 'bd3ca15af7b2edcda51ab3bc34deb434fdd123728cc806bd88fbc469c3bd7123'
AND (
token = 'AFOUdyVSNnnvyg+751VoORSXxDg0SDRMgSMQ8ImhQik='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)