UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cLrVRtN/lLsi4qN0ev1rDGh5cYvn82xn7Wk4+OwxgAw=' 
WHERE 
  key_id = 'b6e8bddba528f8a1afc5cce870060cb099f039a11aacbae176ab481d9be3950f' 
  AND (
    token = 'cLrVRtN/lLsi4qN0ev1rDGh5cYvn82xn7Wk4+OwxgAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043