UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VQISs6EJ7WqVzfQk4F+6KP+D8q+zAWyMhO7sNmYZsVw=' 
WHERE 
  key_id = '37d902a06bc529970bcfc6ef3095edc1e999b3da12e64bf568732d4148c36589' 
  AND (
    token = 'VQISs6EJ7WqVzfQk4F+6KP+D8q+zAWyMhO7sNmYZsVw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025