UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0WMma7TD5D65RnkPQ8BpYQmrYdEgzP4xfMziEAArxUc=' 
WHERE 
  key_id = '7361f0e7df6c56eb4a162f421ca50b2571237506a2c0dc247e42e38423d3f72f' 
  AND (
    token = '0WMma7TD5D65RnkPQ8BpYQmrYdEgzP4xfMziEAArxUc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026