UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WdqOO6tsp9kMbY1YZrj/Tv2BMut/ZXHJ5tq+rPjNW64=' 
WHERE 
  key_id = '78165c139c091cde984e9e088d851ca9eac48a8bfa9298fdf86d1df66e995ba8' 
  AND (
    token = 'WdqOO6tsp9kMbY1YZrj/Tv2BMut/ZXHJ5tq+rPjNW64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029