UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nJvh6l9q1dt2CLmHTQ5+WZfpiwtsZXsK2vl9HvzkMJ0=' 
WHERE 
  key_id = '45642d8064a578b9c60aaee94e2435e38f4740baa38dcfa91953adb7f66b5c7e' 
  AND (
    token = 'nJvh6l9q1dt2CLmHTQ5+WZfpiwtsZXsK2vl9HvzkMJ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034