UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7c8xB+nsI5hkP84RyG/wVwEBPnUduZ16EPSeJTcUTXs=' 
WHERE 
  key_id = '2a01b009f1f3c8a36e7433c3d9d21cdde1ffc6f7cc3e62f3d1afe94e332df884' 
  AND (
    token = '7c8xB+nsI5hkP84RyG/wVwEBPnUduZ16EPSeJTcUTXs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057