UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/4CbvYDy6J9RFwdR1shecIG1KnUrNlfDCGdNUEd/DNY='
WHERE
key_id = '502acd75da6292bb0c5af57911ccf4ec9dbcdda91a044d93151dd27fc19b49e0'
AND (
token = '/4CbvYDy6J9RFwdR1shecIG1KnUrNlfDCGdNUEd/DNY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)