UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lNxPHJ0oR85brihI8OLsGFBHl0FCQ9MBTTQl2s9Geoc='
WHERE
key_id = '8c90238642a9adfa6fbb751c30be2535b02d1f5682ae5a3a70e193d016acffc3'
AND (
token = 'lNxPHJ0oR85brihI8OLsGFBHl0FCQ9MBTTQl2s9Geoc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)