UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KlgSGuG534wwBb3BYliPKi+vUssa2ZQQNgiCCMZTHyo='
WHERE
key_id = 'f9c3565929e5b9456ecba3939c2c294a99965c3c1e3dfeb45eac4c8fc01b0cca'
AND (
token = 'KlgSGuG534wwBb3BYliPKi+vUssa2ZQQNgiCCMZTHyo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)