UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DU5sf0oT8LtTUVuun2hL14sCnlsgBjwUw6q10JagVg8=' 
WHERE 
  key_id = '9d27614a1421c318c47da1dd70a668c92731bc386cf827af3b6785647bb269cb' 
  AND (
    token = 'DU5sf0oT8LtTUVuun2hL14sCnlsgBjwUw6q10JagVg8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035