UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eymhy6CYVp0pcTHbNe9DPTmLxgd8doolrk6MMCoVrYA='
WHERE
key_id = 'b0bf12424947521148f2faafbfcdb80415aebec5ccbfff5584333558f93fb7b5'
AND (
token = 'eymhy6CYVp0pcTHbNe9DPTmLxgd8doolrk6MMCoVrYA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)