UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm4TR9HIRj0Y32VjAv3a+Ag1LUjbhkPjpcCqIgrVSoMs=' 
WHERE 
  key_id = 'f006c70921e549838a76b849e4204408cb829c2af52bdbb3f4fd76d3d041a10f' 
  AND (
    token = 'm4TR9HIRj0Y32VjAv3a+Ag1LUjbhkPjpcCqIgrVSoMs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036