UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'COK2RW45x9Hh8fhqonrIpSjn753fBcdv/dsPGsBKsAs='
WHERE
key_id = 'a184476bf49672d67c11fc2878f18b9ae31358b628cdc4d2aeedd65c66d9513f'
AND (
token = 'COK2RW45x9Hh8fhqonrIpSjn753fBcdv/dsPGsBKsAs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)