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

Query time 0.00032