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