UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I/ZMCpvcjqNNfaqUGxcprXUeHvUlDwAXSiFhIIesz20=' 
WHERE 
  key_id = 'f46baf839da96d46b4fbba207c95845fdd1e03d0dcbeebd9d3d180c87ceefe10' 
  AND (
    token = 'I/ZMCpvcjqNNfaqUGxcprXUeHvUlDwAXSiFhIIesz20=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044