UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tfmynO33bW1esWy1ZxkGUPhlL2N+VeMPu7uo0lrVh4s=' 
WHERE 
  key_id = '35e911b773314419e2f417e7de67f9aa3f3a6020dfa0fdb66c1236b32c376948' 
  AND (
    token = 'tfmynO33bW1esWy1ZxkGUPhlL2N+VeMPu7uo0lrVh4s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056