UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vIHpzShDxyj6SNfpGRWerb1iOwExuxz5Bh4zcmnD3Q8='
WHERE
key_id = '6f0924a98263f6be0f5d1a1f86182948a216b9ff59ae47daca5f4e6962dcc99e'
AND (
token = 'vIHpzShDxyj6SNfpGRWerb1iOwExuxz5Bh4zcmnD3Q8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)