UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z6O+CLHwk7B/xKoCDWxDpkpY7wmxF28+Ep2MggVnBQU='
WHERE
key_id = 'a1851d04966d37bb6b536c332f2dcd4b87ed602831bb8b5364211073a4d2336b'
AND (
token = 'z6O+CLHwk7B/xKoCDWxDpkpY7wmxF28+Ep2MggVnBQU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)