UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sEG8BxBjcPYCE+a9RfmJFT9d1UDqSbxhfpLHOUAIh/M='
WHERE
key_id = 'ff00c5cf37e09bc882f63f2f7bec3b0987408f32f234a741ce24674e64afa295'
AND (
token = 'sEG8BxBjcPYCE+a9RfmJFT9d1UDqSbxhfpLHOUAIh/M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)